//
//  TaocanView.m
//  XDBaseFrameWork
//
//  Created by xindao on 14-9-22.
//  Copyright (c) 2014年 XD-XY. All rights reserved.
//

#import "TaocanView.h"

@implementation TaocanView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self makeViews];
    }
    return self;
}

- (void)makeViews{
    self.backgroundColor = RGBA(239, 239, 239, 1);
    _headIV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 155.5, 210)];
    _headIV.backgroundColor = UIColorFromRGB(0xeaeaea);
    [self addSubview:_headIV];

    UIView * view = [UIView initViewRect:CGRectMake(0, 170, 155.5, 40) andBackGroudColor:[UIColor whiteColor]];
    [self addSubview:view];

    _nameLB = [UILabel initLabelText:@"出生照A套餐" andRect:CGRectMake(0,170,155.5,20) andBackGroudColor:[UIColor clearColor] andTextFont:[UIFont systemFontOfSize:15] andTextColor:RGBA(120, 107, 95, 1) andTextAlignment:NSTextAlignmentCenter];
    [self addSubview:_nameLB];

    _priceLB = [UILabel initLabelText:@"698元" andRect:CGRectMake(0,height_y(_nameLB),155.5,20) andBackGroudColor:[UIColor clearColor] andTextFont:[UIFont systemFontOfSize:15] andTextColor:RGBA(63, 52, 43, 1) andTextAlignment:NSTextAlignmentCenter];
    [self addSubview:_priceLB];

    UIButton * btn = [UIButton initButton:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height) btnNorImage:nil btnHighlightImage:nil btnTitle:nil titleColor:nil titleFont:nil];
    [btn addTarget:self action:@selector(taocanClick) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:btn];
}

- (void)setDataDict:(NSDictionary *)dataDict{
    [_headIV sd_setImageWithURL:[NSURL URLWithString:dataDict[@"Photo"]] placeholderImage:nil];
    _nameLB.text = dataDict[@"SeriesName"];
    _priceLB.text = [NSString stringWithFormat:@"%@元",dataDict[@"Price"]];
}

- (void)taocanClick{
    [_delegate taocanClick:_index];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
